//
//  TabBar.swift
//  DesignCode
//
//  Created by Json on 2020/4/11.
//  Copyright © 2020 Json. All rights reserved.
//

import SwiftUI

struct TabBar: View {
    var body: some View {
        TabView {
            
            Home().tabItem {
                barView(image: "house", text: "Home")
            }
            
            ContentView().tabItem {
                barView()
            }
            
            UpdateList().tabItem {
                barView(image: "gear", text: "Updates")
            }
            
            Settings().tabItem {
                barView(image: "pencil", text: "Settings")
            }
        }
        .edgesIgnoringSafeArea(.top)
    }
}

struct TabBar_Previews: PreviewProvider {
    static var previews: some View {
        Group {
            TabBar() //光亮模式
            TabBar()
                .environment(\.colorScheme, .dark) //夜间模式
                .environment(\.sizeCategory, .extraLarge)
        } //图标字体大小
    }
}

struct barView: View {
    var image = "rectangle.on.rectangle"
    var text = "Certificates"
    var body: some View {
        VStack {
            Image(systemName: image)
            Text(text)
        }
    }
}
